package com.yixq.soa.service.user.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.yixq.soa.service.comm.vo.PageVo;
import com.yixq.soa.service.facade.TbActivityFacade;
import com.yixq.soa.service.queryvo.TbActivityQueryVo;
import com.yixq.soa.service.resultvo.TbActivityResultVo;
import com.yixq.soa.service.web.annotation.Ver;
import com.yixq.soa.service.web.utils.BaseController;
import com.yixq.soa.service.web.utils.PageParam;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@Api(tags = "TbActivityController", description = "活动管理")
@RestController
@RequestMapping("tb_activity")
public class TbActivityController extends BaseController {

	private static final Logger logger = LoggerFactory.getLogger(TbActivityController.class);

	@Autowired
	private TbActivityFacade tbActivityFacade;

	@ApiOperation(value = "活动列表", notes = "活动列表")
	@ApiResponses({ @ApiResponse(code = 200, message = "处理成功") })
	@ApiImplicitParams({
			@ApiImplicitParam(name = "ver", value = "接口版本", paramType = "path", required = true, dataType = "string", defaultValue = "v1") })
	@RequestMapping(path = "/getList/{ver}", method = { RequestMethod.GET, RequestMethod.POST })
	@Ver("1")
	public ResponseEntity<Object> getList(TbActivityQueryVo query, PageParam pageParam, HttpServletRequest request) {
		try {
			PageVo<TbActivityResultVo> pageList = tbActivityFacade.selectTbActivityList(query, pageParam);
			return ok(pageList);
		} catch (Exception e) {
			logger.error("", e);
		}
		return responseIntranetError();
	}
	
}
